package com.qf.admin.controller;

import com.qf.common.http.Result;
import com.qf.entity.po.LoginAdmin;
import com.qf.entity.vo.JqueryTreeView;
import com.qf.service.impl.AdminModuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class IndexController {
    @Autowired
    private AdminModuleService adminModuleService;

    @RequestMapping("index")
    public String toIndex() {
        return "index";
    }

    @RequestMapping("func-list")
    @ResponseBody
    public Result<List<JqueryTreeView>> getModuleList(LoginAdmin loginAdmin) {
        return Result.success(adminModuleService.getModuleByAdminId(loginAdmin.getId()));
    }
}